package com.pie4cloud.pie.job.executor.services.impl;

import com.pie4cloud.pie.job.executor.config.StatisticalFactory;
import com.pie4cloud.pie.job.executor.dto.StatisticalRequest;
import com.pie4cloud.pie.job.executor.services.StatisticalBaseService;
import com.pie4cloud.pie.job.executor.services.StatisticalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StatisticalServiceImpl implements StatisticalService {
	@Autowired
	private StatisticalFactory statisticalFactory;

	public void doOperation(StatisticalRequest statisticalRequest) {
		StatisticalBaseService statisticalBaseService = statisticalFactory.getHandler(statisticalRequest.getStatisticalType());

		statisticalBaseService.doOperation(statisticalRequest);

	}

	public boolean check(StatisticalRequest statisticalRequest){
		StatisticalBaseService statisticalBaseService = statisticalFactory.getHandler(statisticalRequest.getStatisticalType());
		boolean flag=statisticalBaseService.check(statisticalRequest);
		return  flag;
	}


}
